package jehc.djshi.sys.service.impl;
import java.util.List;
import java.util.Map;
import jehc.djshi.sys.dao.XtSmsDao;
import jehc.djshi.sys.model.XtSms;
import jehc.djshi.sys.service.XtSmsService;
import org.springframework.stereotype.Service;
import jehc.djshi.common.base.BaseService;
import jehc.djshi.common.util.ExceptionUtil;
import javax.annotation.Resource;
/**
 * @Desc 短信配置
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class XtSmsServiceImpl extends BaseService implements XtSmsService {

	@Resource
	private XtSmsDao xtSmsDao;

	/**
	 * 分页
	 * @param condition
	 * @return
	 */
	public List<XtSms> getXtSmsListByCondition(Map<String,Object> condition){
		try{
			return xtSmsDao.getXtSmsListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param id
	 * @return
	 */
	public XtSms getXtSmsById(String id){
		try{
			return xtSmsDao.getXtSmsById(id);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param xtSms
	 * @return
	 */
	public int addXtSms(XtSms xtSms){
		int i = 0;
		try {
			xtSms.setId(toUUID());
			xtSms.setCreateId(getXtUid());
			xtSms.setCreateTime(getDate());
			i = xtSmsDao.addXtSms(xtSms);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param xtSms
	 * @return
	 */
	public int updateXtSms(XtSms xtSms){
		int i = 0;
		try {
			xtSms.setUpdateTime(getDate());
			xtSms.setUpdateId(getXtUid());
			i = xtSmsDao.updateXtSms(xtSms);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delXtSms(Map<String,Object> condition){
		int i = 0;
		try {
			i = xtSmsDao.delXtSms(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}